<?php

namespace app\admin\model\classes;

use think\Model;


class Classes extends Model
{

    // 表名
    protected $name = 'classes_class';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = false;

    // 定义时间戳字段名
    protected $createTime = false;
    protected $updateTime = false;
    protected $deleteTime = false;

    // 追加属性
    protected $append = [
        'status_text'
    ];
    
    public function getStatusList()
    {

        //return ['normal' => __('Normal'), 'hidden' => __('Hidden')];
        return [ 'hidden'=>'待审批', 'normal' =>'审批通过'];
    }


    public function getRequireVerifyList()
    {
        return ['0' => '不需要审核', '1' => '需要审核'];
    }



    public function getStatusTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
        $list = $this->getStatusList();
        return isset($list[$value]) ? $list[$value] : '';
    }

    public function teacher()
    {
        return $this->belongsTo('Teacher', 'profile_id', 'profile_id', [], 'LEFT')->setEagerlyType(0);
    }
}
